/******************************************************************************
 * @file:    evis.h
 * @purpose: embedded Visuals Core Header
 * @version: V0.01
 * @date:    12. August. 2009
 * @author:  Michael Bubestinger <michael.bubestinger@gmx.at>
 *----------------------------------------------------------------------------
 *
 *          Add License
 *
 ******************************************************************************/
#ifndef EVIS_H
#define EVIS_H



/*!
 * \typedef EVIS_SPRITE_T
 * @param   size_x: Width
 * @param   size_y: Height
 * @param   *offset: Offset to the sprite
 * @brief Struct for an sprite element
 */
typedef struct EVIS_SPRITE
{
    uint16_t size_x;
    uint16_t size_y;
    uint8_t *sprite;
}EVIS_SPRITE_T;




/*!
 * \typedef EVIS_SCREEN_T
 * @param   *next: next element in list
 * @param   *last: last element in list
 * @param   uid: Unique Identifier of the element
 * @param   priority: Priority 1-255
 * @param   evis_draw: Functionpointer to the drawing routine for the element
 * @param   *object: Pointer to the element structure
 * @param   x: X position
 * @param   y: Y position
 * @param   modified: Was the element modified since the last check? TRUE or FALSE
 * @brief The double linked list holds the description of the screen
 */

typedef struct EVIS_SCREEN
{
    struct EVIS_SCREEN *next;
    struct EVIS_SCREEN *last;
    uint16_t x_pos;
    uint16_t y_pos;
    uint8_t  priority;
    void *object;
    uint8_t  onscreen;
}EVIS_SCREEN_T;

/*!
 * \typedef EVIS_DRAW_FP
 * \brief Functionpointer for the drawing routines
 */
typedef int (*EVIS_DRAW_FP)(uint8_t*, EVIS_SCREEN_T*);




/*
 *\defgroup Evis Screen Handling
 *\brief Functions for handling the double linked list
 *\{@
 */
EVIS_SCREEN_T *evis_screens_new();
EVIS_SCREEN_T *evis_screens_add(EVIS_SCREEN_T *list, EVIS_SCREEN_T *element);
EVIS_SCREEN_T *evis_screens_delete(EVIS_SCREEN_T *list);
/*
 *\@}
 */

/*
 *\defgroup Evis - Drawing
 *\brief Functions for the drawing routines
 *\{@
 */
uint8_t evis_draw_24_rgb_pixel(uint8_t *framebuffer, uint32_t color, uint16_t x, uint16_t y);
uint8_t evis_draw_bmp(uint8_t *framebuffer, uint8_t *sprite, uint16_t x, uint16_t y,uint16_t x_size, uint16_t y_size);
/*
 *\@}
 */

void evis_render(uint8_t *fb, EVIS_SCREEN_T *screen);




typedef struct EVIS_OBJ_IMG
{
    int draw;
    uint16_t uid;
    EVIS_SPRITE_T *sprite;
}EVIS_OBJ_IMG_T;

int *evis_draw_obj_img(uint8_t *fb, EVIS_SCREEN_T *screen);




#endif





